import { Action } from "@remix-run/router"

let defaultState ={
    name:'admin',
    password:12345,
    sex:"男"
}

let userReducer=(state=defaultState,action)=>{
    switch (action.type){
        case "SET_PASSWORD":
            // 拷贝
        let passwordState = {...state}
        // 修改密码 成最新密码
        passwordState.password=action.password
        return passwordState;
        // 设置性别
        case "SET_SEX":
            let SexState = {...state};
            SexState.sex = action.sex;
             return SexState
            default:
            return state;
    }
}

export default userReducer;